package com.expressage.controller;

import com.expressage.po.Package;
import com.expressage.service.PackageService;
import com.expressage.vo.PackageVO;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.security.acl.LastOwnerException;
import java.util.List;
import java.util.Map;

/**
 * 快递信息控制器
 */

@Controller
public class PackageController {

    Logger logger = Logger.getLogger(PackageController.class);
    @Autowired
    PackageService packageService;

    @RequestMapping("/packagebyodd")
    public String packageByOdd(String odd,Model model){
        logger.info("进入快递单号查询控制器");
        PackageVO pack=packageService.findByOdd(odd);
        model.addAttribute("pack",pack);
        return "jspafter/packagebyodd";
    }

    @RequestMapping("/packagelist")
    public String findAll(Model model){
        logger.info("进入快递列表控制器");
       List<PackageVO> list=packageService.findAll();
       model.addAttribute("list",list);
       return "jspafter/packagelist";
    }

    @RequestMapping("/tofindpackage")
    public String toFindPackage(Model model){
        logger.info("进入去查询快递控制器");
        return "jspafter/findpackage";
    }

    @RequestMapping("findbyuid")
    public String findByUid(int uid,Model model){
        logger.info("进入人员编号查询快递信息控制器");
        List<PackageVO> list=packageService.findByUid(uid);
        model.addAttribute("list",list);
        return "jspbefore/findbyuid";
    }
}
